#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QVector>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QTableWidgetItem>
#include "QtMqtt/qmqttclient.h"
#include "QtMqtt/qmqttmessage.h"
#include "wavechart.h"

#define TOPIC_DATA_DEVICEID "data_deviceid"
#define TOPIC_CMD_DEVICEID "cmd_deviceid"
#define TOPIC_DATA_WAVE "data_wave2"
#define TOPIC_CMD_WAVE "cmd_wave"


QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private:
    Ui::Widget *ui;
    QMqttClient* mqttClient;
    //
    QVector<QString> deviceVec;
    QVector<QJsonArray> dataVec;
    //
    WaveChart* waveChartWidget=nullptr;

public slots:
    void mqttConnected();
    void mqttMsgRec(const QByteArray &message, const QMqttTopicName &topic);

private slots:
    void on_pushButton_clicked();
    void on_pushButton_2_clicked();
    void on_tableWidget_cellDoubleClicked(int row, int column);
};
#endif // WIDGET_H
